#include<iostream>
using namespace std;
int n,r,num[20];

// 输出
void printOut(){
    for (int j = 0; j < r;j++)printf("%3d",num[j]);
    puts("");
}

//递归
void dfs(int rank, int cur){
    if(n-cur+rank+2<r) return;
    num[rank]=cur;
    if(r==rank+1) printOut();
    for (int i = cur+1; i <= n; i++) dfs(rank+1,i);
    
}

int main(){
    scanf("%d %d",&n,&r);
    for (int i = 1; i <= n; i++) dfs(0,i);
    return 0;
}